package org.jackysoft.data;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.jackysoft.entity.base.RootEntity;
import org.jackysoft.query.Order;
import org.jackysoft.query.RunnerQuery;

public interface MapperDataProvider<T extends RootEntity> {
	/**
	 * @param id
	 *            mongo 数据对象对象 sid
	 * */
	T findOne(@Param("id")String id) ;

	T queryOne(@Param("query")RunnerQuery query) ;	
	
	List<T> findAll() ;
	
	List<T> query(@Param("query")RunnerQuery query) ;
	List<T> pager(@Param("start") int start ,@Param("rows")int rows) ;
	List<T> queryPager(@Param("query") RunnerQuery query, @Param("start") int start ,@Param("rows")int rows);
	List<T> querySortPager(@Param("query")RunnerQuery query, @Param("sort")Order sort, @Param("start") int start, @Param("rows")int size);
		
	void inert(@Param("bean") T b) ;

	void remove(@Param("id")String id) ;
		
	void removeQuery(@Param("id")String id,@Param("query")RunnerQuery query ) ;
	
	void removeAll() ;

	void update(@Param("bean")T b) ;
	
	void updateQuery(@Param("bean")T b , @Param("query")RunnerQuery query ) ;

	int count() ;

	int countQuery(@Param("query")RunnerQuery qc) ;	
	/**
	 * 对指定集合进行排序,内存临时排序
	 * */
	public void doOrder(@Param("id") String id,@Param("sort")int sort);	

}
